import threading
from time import sleep


def test1(a):
    a.append(33)
    print('test1------%s' % str(a))


def test2(a):
    print('test1------%s' % str(a))


g_nums = [11, 22]

"""
args参数只能传递元组
一个参数: args=((a,)) 记住参数后面必须有一个逗号,否则会报错
多个参数args=((a,b,c)) 后面没有逗号
"""
def main():
    t1 = threading.Thread(target=test1, args=(g_nums,))  # 将g_num传递给test1
    t2 = threading.Thread(target=test2, args=(g_nums,))
    t1.start()
    sleep(1)

    t2.start()
    sleep(1)

    print('test1------%s' % str(g_nums))


if __name__ == '__main__':
    main()
